package com.guanghua.brick.db;

import org.hibernate.SessionFactory;

import com.guanghua.brick.db.extend.hibernate.ExtendHBAnnotationConfiguration;

/**
 * 获取sf的普通实现
 * @author leeon
 */
public class AnnotationHBSessionFactory implements IHBSessionFactory {

	public SessionFactory getSessionFactory(String cfg) throws Exception {
		if (cfg == null) {
			return new ExtendHBAnnotationConfiguration().configure().buildSessionFactory();
		} else {
			return new ExtendHBAnnotationConfiguration().configure("/" + cfg + ".cfg.xml").buildSessionFactory();
		}
	}

}
